<?php

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view' );

class PropertiesViewProperties extends JView
{
	/**	 * Hellos view display method	 * @return void	 **/
	function display($tpl = null)
	{
	$TableName = JRequest::getCmd('table');

	$doc =& JFactory::getDocument();
		$doc->addStyleSheet('components/com_properties/imagenes/properties.css');
	//JToolBarHelper::title(   JText::_( 'Propiedades' ), 'generic.png' );
	$text = $TableName ? JText::_( ' &nbsp; &nbsp; ').JText::_( $TableName ) : JText::_( ' &nbsp; &nbsp; ').JText::_( 'Properties' );
	$icono = $TableName ? JText::_( $TableName.'.png' ) : JText::_( 'properties.png' );
JToolBarHelper::title(   JText::_( $text ), $icono);

		JToolBarHelper::publishList();
		JToolBarHelper::unpublishList();
		JToolBarHelper::deleteList();
		JToolBarHelper::editListX();
		JToolBarHelper::addNewX();
JToolBarHelper::preferences('com_properties', '400');

if($TableName=='category'){
$CatChild		= & $this->get( 'CatChild');
$this->assignRef('CatChild',		$CatChild);
$tpl=$TableName;
}
if($TableName=='type'){
$tpl=$TableName;
}

if($TableName == 'products'){
		
$CatChild		= & $this->get( 'CatChild');
$this->assignRef('CatChild',		$CatChild);
$tpl=$TableName;
}		


if($TableName=='profiles'){
$tpl=$TableName;
$user =& JFactory::getUser();
$this->assignRef('user',$user);	
}

if($TableName){
$items		= & $this->get( 'Data');
$pagination =& $this->get('Pagination');
$lists = & $this->get('List');

$this->assignRef('items',		$items);
$this->assignRef('pagination', $pagination);
$this->assignRef('lists', $lists);
parent::display($tpl);
}else{

jimport('joomla.html.pane');
$pane	=& JPane::getInstance('sliders');		

$products		= $this->get( 'Totalproducts' );
$categories		= $this->get( 'Totalcategories' );
$types			= $this->get( 'Totaltypes' );
$agents			= $this->get( 'Totalagents' );
$publisher		= $this->get( 'Totalpublisher' );
$registered		= $this->get( 'Totalregistered' );
$morevisited	= $this->get( 'Morevisited' );

$this->assignRef( 'products'		, $products );
$this->assignRef( 'categories'		, $categories );
$this->assignRef( 'types'		, $types );
$this->assignRef( 'agents'		, $agents );
$this->assignRef( 'publisher'		, $publisher );
$this->assignRef( 'registered'		, $registered );
$this->assignRef( 'morevisited'		, $morevisited );

		$this->assignRef( 'pane'		, $pane );
		parent::display( 'panel' );
		
		







}
		
	}
	
	
	
	function addIcon( $image , $table, $text )
	{
		$lang		=& JFactory::getLanguage();
		$link		= 'index.php?option=com_properties&table='.$table.'&limitstart=0&filter_order=ordering';
?>
		<div style="float:<?php echo ($lang->isRTL()) ? 'right' : 'left'; ?>;">
			<div class="icon">
				<a href="<?php echo $link; ?>">
					<?php echo JHTML::_('image', 'administrator/components/com_properties/imagenes/' . $image , NULL, NULL, $text ); ?>
					<span><?php echo $text; ?></span></a>
			</div>
		</div>
<?php
	}
	
	
	
}